From: Florian Müllner Date: Sun, 19 May 2013 10:26:49 +0000 (+0200) Subject: screenshot: Check for NULL window in screenshot_window() X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~4156 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c68ccbf263061e2df945ee344098b2d46459414b;p=gnome-shell.git screenshot: Check for NULL window in screenshot_window() screenshot_window() currently assumes a focus window, which will result in a crash if that's not the case. https://bugzilla.gnome.org/show_bug.cgi?id=700625 --- diff --git a/src/shell-screenshot.c b/src/shell-screenshot.c index c354612c5..4eca28983 100644 --- a/src/shell-screenshot.c +++ b/src/shell-screenshot.c @@ -492,6 +492,17 @@ shell_screenshot_screenshot_window (ShellScreenshot *screenshot, screenshot_data->filename = g_strdup (filename); screenshot_data->callback = callback; + if (!window) + { + screenshot_data->filename_used = g_strdup (""); + result = g_simple_async_result_new (NULL, on_screenshot_written, (gpointer)screenshot_data, shell_screenshot_screenshot_window); + g_simple_async_result_set_op_res_gboolean (result, FALSE); + g_simple_async_result_complete (result); + g_object_unref (result); + + return; + } + window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window)); clutter_actor_get_position (window_actor, &actor_x, &actor_y);